package com.broada.apm.logic.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.broada.apm.base.BaseLogic;
import com.broada.apm.logic.ResourceLogic;
import com.broada.apm.model.Resource;
import com.broada.apm.utils.ExceptionUtils;

public class ResourceLogicImpl extends BaseLogic implements ResourceLogic {
	
	private Logger log = LoggerFactory.getLogger(ResourceLogicImpl.class);
	
	@Override
	public List<Resource> queryKeyTrade(String appId) {
		return resourceService.getKeyResourcesByAppId(appId);
	}

	@Override
	public List<Resource> queryResourcesByIds(List<String> ids) {
		return resourceService.getResourceByIds(ids);
	}

	@Override
	public Resource queryKeyResourceById(String tradeId) {
		Resource res = new Resource();
		try {
			res = resourceService.getKeyResourceById(tradeId);
		} catch (Exception e) {
			ExceptionUtils.error(log, "查询资源失败", e);
		}
		return res;
	}

}
